const mongoose = require('mongoose')

const Schema = mongoose.Schema

mongoose.connect('mongodb://localhost/test')

const userSchema = new Schema({
	username:{
		type:String,
		required:true
	},
	password:{
		type:String,
		required:true
	},
	email:{
		type:String
	}
})

var User = mongoose.model('User', userSchema)

new User({
	usernames:'李四',
	password:'111111',
	email:'ls@bb.com'
}).save().then(()=>console.log('ok'), (err) => {console.log('err'); console.log('error')})